<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .widthF {
      width: 300px;
      height: 300px;
      background: red;
    }

    .widthS {
      width: 100px;
      height: 100px;
      background: gray;
    }

    .father_1 {
      position: relative;
    }

    .son_1 {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: -50px;
      margin-top: -50px;
    }
  </style>
</head>

<body>
<!-- PC端有兼容性要求，宽高固定，推荐absolute + 负margin 使用该方式 -->
  <div class="father_1 widthF">
    <div class="son_1 widthS">
    </div>
  </div>

</body>

</html>